package com.fingard.dsp.bank.directbank.specialDeal;

import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import com.fingard.FGBiz;

public class AutoQueryTrans {

    public static void run() throws Exception {
        ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);

        if (FGBiz.dspCenter.enableAutoTodayTrans) {
            final TimerTask task1 = new TimerTask() {
                public void run() {
                    System.out.println("开始自动查询当日明细");
                    TransHelper transHelper = new TransHelper();
                    transHelper.queryCurFromBank();

                }
            };
            pool.scheduleAtFixedRate(task1, 0, 5, TimeUnit.MINUTES);
        }

        if(FGBiz.dspCenter.enableAutoHisTrans){
            final TimerTask task1 = new TimerTask() {
                public void run() {
                    System.out.println("开始自动查询历史明细");
                    TransHelper transHelper = new TransHelper();
                    transHelper.queryHisFromBank();
                }
            };
            pool.scheduleAtFixedRate(task1, 3, 6*60, TimeUnit.MINUTES);
        }
    }


}
